package com.job.shuang.HomeWork0707;

import java.util.Arrays;

/**
 * @author Liushuang
 * @version 1.0
 * @since 2022-07-08 10:20:26
 */
public class MyHelper0707 {
    private String name;
    private int age;
    private String specialty;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge(int i) {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSpecialty(String sj) {
        return specialty;
    }

    public void setSpecialty(String specialty) {
        this.specialty = specialty;
    }

    public void selfIntroduction(){
        System.out.println("我叫："+this.name+"我今年："+this.age+"我的专业是："+this.specialty);
    }
    public double Mid(double[] arr ){
        Arrays.sort(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        int len=arr.length;
        double mid,average;
        if ((len&2)==0){
            mid=(arr[len/2-1]+arr[len/2])/2;
        }else {
            mid=arr[len/2];
        }
        double sum=0;
        for (double i:arr){
            sum=sum+i;
        }
        average=sum/len;
        if (mid<average){
            return average;
        }else {
            final double mid1 = mid;
            return mid1;
        }
    }
    public static void main(String[] args) {
        MyHelper0707 mp=new MyHelper0707();
        mp.setName("刘爽");
        mp.getAge(20);
        mp.getSpecialty("数据科学与大数据技术");
        mp.selfIntroduction();
        double[] arr={};
        double n=mp.Mid(arr);
        System.out.println(n);
    }
}
